From 0664bd4164536be723f0864b18fb56e0f6b699d0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Wed, 4 Apr 2018 23:49:55 +0200 Subject: [PATCH] extension: add some Y' u8 fast paths GIMP makes use of "Y' u8" to "R'G'B' u8" and we had no paths covering it, making it go through floating point. This commit adds code paths for expanding single grayscale u8 to R'G'B and R'G'B'A as well as R'aG'aB'aA u8. --- extensions/gggl.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/extensions/gggl.c b/extensions/gggl.c index 625d730..8195ba1 100644 --- a/extensions/gggl.c +++ b/extensions/gggl.c @@ -484,6 +484,37 @@ conv_gF_rgbF (const Babl *conversion,unsigned char *src, unsigned char *dst, lon } } +static void +conv_g8_rgb8 (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples) +{ + long n = samples; + + while (n--) + { + dst[0]=*src; + dst[1]=*src; + dst[2]=*src; + dst += 3; + src += 1; + } +} +#define conv_g8_rgbA8 conv_g8_rgba8 +static void +conv_g8_rgba8 (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples) +{ + long n = samples; + + while (n--) + { + dst[0]=*src; + dst[1]=*src; + dst[2]=*src; + dst[3]=255; + dst += 4; + src += 1; + } +} + static void conv_gaF_rgbaF (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples) { @@ -1067,6 +1098,9 @@ init (void) o (ga8, gaF); o (gA8, gAF); o (g8, gF); + o (g8, rgb8); + o (g8, rgba8); + o (g8, rgbA8); o (gaF, ga16); o (gAF, gA16); o (gF, g16); -- 2.30.2